package elsa.bootmapper;

import java.util.List;

import org.apache.ibatis.annotations.*;

import elsa.bean.*;

@Mapper
public interface ConstMapper {

	/*
	 * 建造检验操作
	 */
	//信息提醒条数(所有 管理员/负责人)
	@Select("select count(*) from scs_constinsp")
	int constInfoReminderCount();

	//信息提醒(所有 管理员)
	@Select("select inspnum, shipname, alltime, allstate from scs_constinsp order by alltime desc")
	List<ScsConstinsp>  constInfoReminder();

	//信息提醒条数(检验编号  模糊查询 管理员/负责人)
	@Select("select count(*) from scs_constinsp where inspnum like CONCAT(CONCAT('%', #{inspnum}), '%')")
	int constInfoReminderCountByInspnum(String inspnum);

	//信息提醒(检验编号  模糊查询 管理员/负责人)
	@Select("select inspnum, shipname, alltime, allstate from scs_constinsp where inspnum like CONCAT(CONCAT('%', #{inspnum}), '%') order by alltime desc")
	List<ScsConstinsp>  constInfoReminderByInspnum(String inspnum);

	//信息提醒条数(船名  模糊查询 管理员/负责人)
	@Select("select count(*) from scs_constinsp where shipname like CONCAT(CONCAT('%', #{shipname}), '%')")
	int constInfoReminderCountByShipname(String shipname);

	//信息提醒(船名  模糊查询 管理员/负责人)
	@Select("select inspnum, shipname, alltime, allstate from scs_constinsp where shipname like CONCAT(CONCAT('%', #{shipname}), '%') order by alltime desc")
	List<ScsConstinsp>  constInfoReminderByShipname(String shipname);


	//信息提醒条数(所有 验船师)
	@Select("select count(*) from scs_constinsp where (ctid = #{ycsid,jdbcType=VARCHAR} or ljid = #{ycsid,jdbcType=VARCHAR} or dqid = #{ycsid,jdbcType=VARCHAR}) and state != '禁用'")
	int constYcsInfoReminderCount(String ycsid);

	//信息提醒(所有 验船师)
	@Select("select inspnum, shipname, alltime, allstate from scs_constinsp where (ctid = #{ycsid,jdbcType=VARCHAR} or ljid = #{ycsid,jdbcType=VARCHAR} or dqid = #{ycsid,jdbcType=VARCHAR}) and state != '禁用' order by alltime desc")
	List<ScsConstinsp>  constYcsInfoReminder(String ycsid);

	//信息提醒条数(检验编号  模糊查询 验船师)
	@Select("select count(*) from scs_constinsp where inspnum like CONCAT(CONCAT('%', #{inspnum}), '%') and (ctid = #{ycsid,jdbcType=VARCHAR} or ljid = #{ycsid,jdbcType=VARCHAR} or dqid = #{ycsid,jdbcType=VARCHAR}) and state != '禁用'")
	int constYcsInfoReminderCountByInspnum(@Param("inspnum") String inspnum, @Param("ycsid") String ycsid);

	//信息提醒(检验编号  模糊查询 验船师)
	@Select("select inspnum, shipname, alltime, allstate from scs_constinsp where inspnum like CONCAT(CONCAT('%', #{inspnum}), '%') and (ctid = #{ycsid,jdbcType=VARCHAR} or ljid = #{ycsid,jdbcType=VARCHAR} or dqid = #{ycsid,jdbcType=VARCHAR}) and state != '禁用' order by alltime desc")
	List<ScsConstinsp>  constYcsInfoReminderByInspnum(@Param("inspnum") String inspnum, @Param("ycsid") String ycsid);

	//信息提醒条数(船名  模糊查询 验船师)
	@Select("select count(*) from scs_constinsp where shipname like CONCAT(CONCAT('%', #{shipname}), '%') and (ctid = #{ycsid,jdbcType=VARCHAR} or ljid = #{ycsid,jdbcType=VARCHAR} or dqid = #{ycsid,jdbcType=VARCHAR}) and state != '禁用'")
	int constYcsInfoReminderCountByShipname(@Param("shipname") String shipname, @Param("ycsid") String ycsid);

	//信息提醒(船名  模糊查询 验船师)
	@Select("select inspnum, shipname, alltime, allstate from scs_constinsp where shipname like CONCAT(CONCAT('%', #{shipname}), '%') and (ctid = #{ycsid,jdbcType=VARCHAR} or ljid = #{ycsid,jdbcType=VARCHAR} or dqid = #{ycsid,jdbcType=VARCHAR}) and state != '禁用' order by alltime desc")
	List<ScsConstinsp>  constYcsInfoReminderByShipname(@Param("shipname") String shipname, @Param("ycsid") String ycsid);

	//信息提醒条数(所有 船厂)
	@Select("select count(*) from scs_constinsp where ccid = #{ccid,jdbcType=VARCHAR} and state != '禁用'")
	int constCcInfoReminderCount(String ccid);

	//信息提醒(所有 船厂)
	@Select("select inspnum, shipname, alltime, allstate from scs_constinsp where ccid = #{ccid,jdbcType=VARCHAR} and state != '禁用' order by alltime desc")
	List<ScsConstinsp>  constCcInfoReminder(String ccid);

	//信息提醒条数(检验编号  模糊查询 船厂)
	@Select("select count(*) from scs_constinsp where inspnum like CONCAT(CONCAT('%', #{inspnum}), '%') and ccid = #{ccid,jdbcType=VARCHAR} and state != '禁用'")
	int constCcInfoReminderCountByInspnum(@Param("inspnum") String inspnum, @Param("ccid") String ccid);

	//信息提醒(检验编号  模糊查询 船厂)
	@Select("select inspnum, shipname, alltime, allstate from scs_constinsp where inspnum like CONCAT(CONCAT('%', #{inspnum}), '%') and ccid = #{ccid,jdbcType=VARCHAR} and state != '禁用' order by alltime desc")
	List<ScsConstinsp>  constCcInfoReminderByInspnum(@Param("inspnum") String inspnum, @Param("ccid") String ccid);

	//信息提醒条数(船名  模糊查询 船厂)
	@Select("select count(*) from scs_constinsp where shipname like CONCAT(CONCAT('%', #{shipname}), '%') and ccid = #{ccid,jdbcType=VARCHAR} and state != '禁用'")
	int constCcInfoReminderCountByShipname(@Param("shipname") String shipname, @Param("ccid") String ccid);

	//信息提醒(船名  模糊查询 船厂)
	@Select("select inspnum, shipname, alltime, allstate from scs_constinsp where shipname like CONCAT(CONCAT('%', #{shipname}), '%') and ccid = #{ccid,jdbcType=VARCHAR} and state != '禁用' order by alltime desc")
	List<ScsConstinsp>  constCcInfoReminderByShipname(@Param("shipname") String shipname, @Param("ccid") String ccid);

	//信息提醒条数(所有 船东)
	@Select("select count(*) from scs_constinsp where cdid = #{cdid,jdbcType=VARCHAR} and state != '禁用'")
	int constCdInfoReminderCount(String cdid);

	//信息提醒(所有 船东)
	@Select("select inspnum, shipname, alltime, allstate from scs_constinsp where cdid = #{cdid,jdbcType=VARCHAR} and state != '禁用' order by alltime desc")
	List<ScsConstinsp>  constCdInfoReminder(String cdid);

	//信息提醒条数(检验编号  模糊查询 船东)
	@Select("select count(*) from scs_constinsp where inspnum like CONCAT(CONCAT('%', #{inspnum}), '%') and cdid = #{cdid,jdbcType=VARCHAR} and state != '禁用'")
	int constCdInfoReminderCountByInspnum(@Param("inspnum") String inspnum, @Param("cdid") String cdid);

	//信息提醒(检验编号  模糊查询 船东)
	@Select("select inspnum, shipname, alltime, allstate from scs_constinsp where inspnum like CONCAT(CONCAT('%', #{inspnum}), '%') and cdid = #{cdid,jdbcType=VARCHAR} and state != '禁用' order by alltime desc")
	List<ScsConstinsp>  constCdInfoReminderByInspnum(@Param("inspnum") String inspnum, @Param("cdid") String cdid);

	//信息提醒条数(船名  模糊查询 船东)
	@Select("select count(*) from scs_constinsp where shipname like CONCAT(CONCAT('%', #{shipname}), '%') and cdid = #{cdid,jdbcType=VARCHAR} and state != '禁用'")
	int constCdInfoReminderCountByShipname(@Param("shipname") String shipname, @Param("cdid") String cdid);

	//信息提醒(船名  模糊查询 船东)
	@Select("select inspnum, shipname, alltime, allstate from scs_constinsp where shipname like CONCAT(CONCAT('%', #{shipname}), '%') and cdid = #{cdid,jdbcType=VARCHAR} and state != '禁用' order by alltime desc")
	List<ScsConstinsp>  constCdInfoReminderByShipname(@Param("shipname") String shipname, @Param("cdid") String cdid);

	//更新所有状态
	@Update("update scs_constinsp set allstate = #{allstate,jdbcType=VARCHAR},alltime = #{alltime} where inspnum = #{inspnum,jdbcType=VARCHAR}")
	void updateAll(ScsConstinsp scsConstinsp);

	//历史查询建造检验条数(所有)
	@Select("select count(*) from scs_constinsp where completenum > 0")
	int historyAllConstCount();

	//历史查询建造检验列表(所有)
	@Select("select inspnum, shipname, insptype, figuredate, schddate, ctname, ljname, dqname, ccinfo, cdname, state from scs_constinsp where completenum > 0 order by latesttime desc")
	List<ScsConstinsp>  historyAllConst();

	//历史查询建造检验条数(检验编号 模糊查询)
	@Select("select count(*) from scs_constinsp where inspnum like CONCAT(CONCAT('%', #{inspnum}), '%') and state = '完成'")
	int historyInspnumConstCount(String inspnum);

	//历史查询建造检验列表(检验编号 模糊查询)
	@Select("select inspnum, shipname, insptype, figuredate, schddate, ctname, ljname, dqname, ccinfo, cdname, state from scs_constinsp where inspnum like CONCAT(CONCAT('%', #{inspnum}), '%') and completenum > 0 order by latesttime desc")
	List<ScsConstinsp>  historyInspnumConst(String inspnum);

	//历史查询建造检验条数(船名 模糊查询)
	@Select("select count(*) from scs_constinsp where shipname like CONCAT(CONCAT('%', #{shipname}), '%') and completenum > 0")
	int historyShipnameConstCount(String shipname);

	//历史查询建造检验列表(船名 模糊查询)
	@Select("select inspnum, shipname, insptype, figuredate, schddate, ctname, ljname, dqname, ccinfo, cdname, state from scs_constinsp where shipname like CONCAT(CONCAT('%', #{shipname}), '%') and completenum > 0 order by latesttime desc")
	List<ScsConstinsp>  historyShipnameConst(String shipname);

	//查询建造检验条数(所有 管理员/负责人)
	@Select("select count(*) from scs_constinsp")
	int findConstCount();

	//查询建造检验列表(所有 管理员/负责人)
	@Select("select inspnum, shipname, insptype, figuredate, schddate, ctname, ljname, dqname, ccinfo, cdname, state from scs_constinsp order by latesttime desc")
	List<ScsConstinsp> findAllConst();

	//查询建造检验条数(检验编号 模糊查询 管理员/负责人)
	@Select("select count(*) from scs_constinsp where inspnum like CONCAT(CONCAT('%', #{inspnum}), '%')")
	int findConstCountByInspnum(String inspnum);

	//查询建造检验列表(检验编号 模糊查询 管理员/负责人)
	@Select("select inspnum, shipname, insptype, figuredate, schddate, ctname, ljname, dqname, ccinfo, cdname, state from scs_constinsp where inspnum like CONCAT(CONCAT('%', #{inspnum}), '%') order by latesttime desc")
	List<ScsConstinsp> findAllConstByInspnum(String inspnum);

	//查询建造检验条数(船名 模糊查询 管理员/负责人)
	@Select("select count(*) from scs_constinsp where shipname like CONCAT(CONCAT('%', #{shipname}), '%')")
	int findConstCountByShipname(String shipname);

	//查询建造检验列表(船名 模糊查询 管理员/负责人)
	@Select("select inspnum, shipname, insptype, figuredate, schddate, ctname, ljname, dqname, ccinfo, cdname, state from scs_constinsp where shipname like CONCAT(CONCAT('%', #{shipname}), '%') order by latesttime desc")
	List<ScsConstinsp> findAllConstByShipname(String shipname);


	//查询建造检验条数(所有 验船师)
	@Select("select count(*) from scs_constinsp where state!='禁用' and (ctid = #{ycsid,jdbcType=VARCHAR} or ljid = #{ycsid,jdbcType=VARCHAR} or dqid = #{ycsid,jdbcType=VARCHAR})")
	int findYcsConstCount(String ycsid);

	//查询建造检验列表(所有 验船师)
	@Select("select inspnum, shipname, insptype, figuredate, schddate, ctname, ljname, dqname, ccinfo, cdname, state from scs_constinsp where state!='禁用' and (ctid = #{ycsid,jdbcType=VARCHAR} or ljid = #{ycsid,jdbcType=VARCHAR} or dqid = #{ycsid,jdbcType=VARCHAR}) order by latesttime desc")
	List<ScsConstinsp> findYcsConst(String ycsid);

	//查询建造检验条数(检验编号 模糊查询 验船师)
	@Select("select count(*) from scs_constinsp where inspnum like CONCAT(CONCAT('%', #{inspnum}), '%') and state!='禁用' and (ctid = #{ycsid,jdbcType=VARCHAR} or ljid = #{ycsid,jdbcType=VARCHAR} or dqid = #{ycsid,jdbcType=VARCHAR})")
	int findYcsConstCountByInspnum(@Param("inspnum") String inspnum, @Param("ycsid") String ycsid);

	//查询建造检验列表(检验编号 模糊查询 验船师)
	@Select("select inspnum, shipname, insptype, figuredate, schddate, ctname, ljname, dqname, ccinfo, cdname, state from scs_constinsp where inspnum like CONCAT(CONCAT('%', #{inspnum}), '%') and state!='禁用' and (ctid = #{ycsid,jdbcType=VARCHAR} or ljid = #{ycsid,jdbcType=VARCHAR} or dqid = #{ycsid,jdbcType=VARCHAR}) order by latesttime desc")
	List<ScsConstinsp> findYcsConstByInspnum(@Param("inspnum") String inspnum, @Param("ycsid") String ycsid);

	//查询建造检验条数(船名 模糊查询 验船师)
	@Select("select count(*) from scs_constinsp where shipname like CONCAT(CONCAT('%', #{shipname}), '%') and state!='禁用' and (ctid = #{ycsid,jdbcType=VARCHAR} or ljid = #{ycsid,jdbcType=VARCHAR} or dqid = #{ycsid,jdbcType=VARCHAR})")
	int findYcsConstCountByShipname(@Param("shipname") String shipname, @Param("ycsid") String ycsid);

	//查询建造检验列表(船名 模糊查询 验船师)
	@Select("select inspnum, shipname, insptype, figuredate, schddate, ctname, ljname, dqname, ccinfo, cdname, state from scs_constinsp where shipname like CONCAT(CONCAT('%', #{shipname}), '%') and state!='禁用' and (ctid = #{ycsid,jdbcType=VARCHAR} or ljid = #{ycsid,jdbcType=VARCHAR} or dqid = #{ycsid,jdbcType=VARCHAR}) order by latesttime desc")
	List<ScsConstinsp> findYcsConstByShipname(@Param("shipname") String shipname, @Param("ycsid") String ycsid);


	//查询建造检验条数(所有 船厂)
	@Select("select count(*) from scs_constinsp where state!='禁用' and ccid = #{ccid,jdbcType=VARCHAR}")
	int findCcConstCount(String ccid);

	//查询建造检验列表(所有 船厂)
	@Select("select inspnum, shipname, insptype, figuredate, schddate, ctname, ljname, dqname, ccinfo, cdname, state from scs_constinsp where state!='禁用' and ccid = #{ccid,jdbcType=VARCHAR} order by latesttime desc")
	List<ScsConstinsp> findCcConst(String ccid);

	//查询建造检验条数(检验编号 模糊查询 船厂)
	@Select("select count(*) from scs_constinsp where inspnum like CONCAT(CONCAT('%', #{inspnum}), '%') and state!='禁用' and ccid = #{ccid,jdbcType=VARCHAR}")
	int findCcConstCountByInspnum(@Param("inspnum") String inspnum, @Param("ccid") String ccid);

	//查询建造检验列表(检验编号 模糊查询 船厂)
	@Select("select inspnum, shipname, insptype, figuredate, schddate, ctname, ljname, dqname, ccinfo, cdname, state from scs_constinsp where inspnum like CONCAT(CONCAT('%', #{inspnum}), '%') and state!='禁用' and ccid = #{ccid,jdbcType=VARCHAR} order by latesttime desc")
	List<ScsConstinsp> findCcConstByInspnum(@Param("inspnum") String inspnum, @Param("ccid") String ccid);

	//查询建造检验条数(船名 模糊查询 船厂)
	@Select("select count(*) from scs_constinsp where shipname like CONCAT(CONCAT('%', #{shipname}), '%') and state!='禁用' and ccid = #{ccid,jdbcType=VARCHAR}")
	int findCcConstCountByShipname(@Param("shipname") String shipname, @Param("ccid") String ccid);

	//查询建造检验列表(船名 模糊查询 船厂)
	@Select("select inspnum, shipname, insptype, figuredate, schddate, ctname, ljname, dqname, ccinfo, cdname, state from scs_constinsp where shipname like CONCAT(CONCAT('%', #{shipname}), '%') and state!='禁用' and ccid = #{ccid,jdbcType=VARCHAR} order by latesttime desc")
	List<ScsConstinsp> findCcConstByShipname(@Param("shipname") String shipname, @Param("ccid") String ccid);

	//查询建造检验条数(所有 船东)
	@Select("select count(*) from scs_constinsp where state!='禁用' and cdid = #{cdid,jdbcType=VARCHAR}")
	int findCdConstCount(String cdid);

	//查询建造检验列表(所有 船东)
	@Select("select inspnum, shipname, insptype, figuredate, schddate, ctname, ljname, dqname, ccinfo, cdname, state from scs_constinsp where state!='禁用' and cdid = #{cdid,jdbcType=VARCHAR} order by latesttime desc")
	List<ScsConstinsp> findCdConst(String cdid);

	//查询建造检验条数(检验编号 模糊查询 船东)
	@Select("select count(*) from scs_constinsp where inspnum like CONCAT(CONCAT('%', #{inspnum}), '%') and state!='禁用' and cdid = #{cdid,jdbcType=VARCHAR}")
	int findCdConstCountByInspnum(@Param("inspnum") String inspnum, @Param("cdid") String cdid);

	//查询建造检验列表(检验编号 模糊查询 船东)
	@Select("select inspnum, shipname, insptype, figuredate, schddate, ctname, ljname, dqname, ccinfo, cdname, state from scs_constinsp where inspnum like CONCAT(CONCAT('%', #{inspnum}), '%') and state!='禁用' and cdid = #{cdid,jdbcType=VARCHAR} order by latesttime desc")
	List<ScsConstinsp> findCdConstByInspnum(@Param("inspnum") String inspnum, @Param("cdid") String cdid);

	//查询建造检验条数(船名 模糊查询 船东)
	@Select("select count(*) from scs_constinsp where shipname like CONCAT(CONCAT('%', #{shipname}), '%') and state!='禁用' and cdid = #{cdid,jdbcType=VARCHAR}")
	int findCdConstCountByShipname(@Param("shipname") String shipname, @Param("cdid") String cdid);

	//查询建造检验列表(船名 模糊查询 船东)
	@Select("select inspnum, shipname, insptype, figuredate, schddate, ctname, ljname, dqname, ccinfo, cdname, state from scs_constinsp where shipname like CONCAT(CONCAT('%', #{shipname}), '%') and state!='禁用' and cdid = #{cdid,jdbcType=VARCHAR} order by latesttime desc")
	List<ScsConstinsp> findCdConstByShipname(@Param("shipname") String shipname, @Param("cdid") String cdid);

	//查询建造检验信息(检验编号)
	@Select("select inspnum, shipname, insptype, shiplength, grosston, hostpower, region, shipstops, shiptype, designunit, figurenum, approvalnum, figuredate, schddate, cdname, cdusername, ccpronum, info1, info1num, info1adr, info2, info2num, "
			+ "info2adr, info3, info3adr, info4, info4name, info4adr, additional, apunitname, fax, zipcode, crecode, writedate, ccadr, writename, ccinfo, remarks, state, ctname, ctusername, ljname, ljusername, dqname, dqusername, headman, auditstate, auditopn, auditdate, latesttime, cdid, ccid, ctid, ljid, dqid"
			+ " from scs_constinsp where inspnum = #{inspnum,jdbcType=VARCHAR}")
	ScsConstinsp findConstByInspnum(String inspnum);

	//打印建造检验申请表
	@Select("select inspnum, shipname, insptype, shiplength, grosston, hostpower, region, shipstops, shiptype, designunit, figurenum, approvalnum, "
			+ "figuredate, schddate, cdname, cdusername, ccpronum, info1, info1num, info2, info2num, info3, info4, info4name, additional, apunitname, fax, zipcode, crecode, writedate, ccadr, writename, ccinfo, remarks from scs_constinsp where inspnum = #{inspnum,jdbcType=VARCHAR}")
	ScsConstinsp printConstByInspnum(String inspnum);

	//新建建造检验-船厂提交
	@Insert("insert into scs_constinsp (inspnum, shipname, insptype, shiplength, grosston, hostpower, region, shipstops, shiptype, designunit, figurenum, approvalnum, figuredate, schddate, cdname, cdusername, ccpronum, info1, "
			+ "info1num, info1adr, info2, info2num, info2adr, info3, info3adr, info4, info4name, info4adr, additional, apunitname, fax, zipcode, crecode, writedate, ccadr, writename, ccinfo, remarks, allstate, alltime, state, latesttime, flag, ccid, cdid) values (#{inspnum,jdbcType=VARCHAR}, #{shipname,jdbcType=VARCHAR}, "
			+ "#{insptype,jdbcType=VARCHAR}, #{shiplength,jdbcType=VARCHAR}, #{grosston,jdbcType=VARCHAR}, #{hostpower,jdbcType=VARCHAR}, #{region,jdbcType=VARCHAR}, #{shipstops,jdbcType=VARCHAR}, #{shiptype,jdbcType=VARCHAR}, #{designunit,jdbcType=VARCHAR}, #{figurenum,jdbcType=VARCHAR}, "
			+ "#{approvalnum,jdbcType=VARCHAR}, #{figuredate,jdbcType=DATE}, #{schddate,jdbcType=DATE}, #{cdname,jdbcType=VARCHAR}, #{cdusername,jdbcType=VARCHAR}, #{ccpronum,jdbcType=VARCHAR}, #{info1,jdbcType=BIT}, #{info1num,jdbcType=INTEGER}, #{info1adr,jdbcType=VARCHAR}, #{info2,jdbcType=BIT}, "
			+ "#{info2num,jdbcType=INTEGER}, #{info2adr,jdbcType=VARCHAR}, #{info3,jdbcType=BIT}, #{info3adr,jdbcType=VARCHAR}, #{info4,jdbcType=BIT}, #{info4name,jdbcType=VARCHAR}, #{info4adr,jdbcType=VARCHAR}, #{additional,jdbcType=VARCHAR}, #{apunitname,jdbcType=VARCHAR}, "
			+ "#{fax,jdbcType=VARCHAR}, #{zipcode,jdbcType=VARCHAR}, #{crecode,jdbcType=VARCHAR}, #{writedate,jdbcType=DATE}, #{ccadr,jdbcType=VARCHAR}, #{writename,jdbcType=VARCHAR}, #{ccinfo,jdbcType=VARCHAR}, #{remarks,jdbcType=VARCHAR}, #{allstate,jdbcType=VARCHAR}, #{alltime}, #{state,jdbcType=VARCHAR}, #{latesttime}, #{flag,jdbcType=VARCHAR}, #{ccid,jdbcType=VARCHAR}, #{cdid,jdbcType=VARCHAR})")
	void saveConst(ScsConstinsp scsConstinsp);

	//更新建造检验-船厂提交
	@Update("update scs_constinsp set shipname = #{shipname,jdbcType=VARCHAR},insptype = #{insptype,jdbcType=VARCHAR},shiplength = #{shiplength,jdbcType=VARCHAR},grosston = #{grosston,jdbcType=VARCHAR},"
			+ "hostpower = #{hostpower,jdbcType=VARCHAR},region = #{region,jdbcType=VARCHAR},shipstops = #{shipstops,jdbcType=VARCHAR},shiptype = #{shiptype,jdbcType=VARCHAR},designunit = #{designunit,jdbcType=VARCHAR},figurenum = #{figurenum,jdbcType=VARCHAR},approvalnum = #{approvalnum,jdbcType=VARCHAR},figuredate = #{figuredate,jdbcType=DATE},"
			+ "schddate = #{schddate,jdbcType=DATE},cdname = #{cdname,jdbcType=VARCHAR},cdusername = #{cdusername,jdbcType=VARCHAR},ccpronum = #{ccpronum,jdbcType=VARCHAR},additional = #{additional,jdbcType=VARCHAR},apunitname = #{apunitname,jdbcType=VARCHAR},fax = #{fax,jdbcType=VARCHAR},zipcode = #{zipcode,jdbcType=VARCHAR},crecode = #{crecode,jdbcType=VARCHAR},"
			+ "writedate = #{writedate,jdbcType=DATE},ccadr = #{ccadr,jdbcType=VARCHAR},writename = #{writename,jdbcType=VARCHAR},ccinfo = #{ccinfo,jdbcType=VARCHAR},remarks = #{remarks,jdbcType=VARCHAR},alltime = #{alltime},latesttime = #{latesttime},ccid = #{ccid,jdbcType=VARCHAR},cdid = #{cdid,jdbcType=VARCHAR} where inspnum = #{inspnum,jdbcType=VARCHAR}")
	void updateConst(ScsConstinsp scsConstinsp);

	//更新建造检验-船检处审核+检验编号
	@Update("update scs_constinsp set inspnum = #{ainspnum,jdbcType=VARCHAR},ctname = #{ctname,jdbcType=VARCHAR},ctusername = #{ctusername,jdbcType=VARCHAR},ljname = #{ljname,jdbcType=VARCHAR},ljusername = #{ljusername,jdbcType=VARCHAR},dqname = #{dqname,jdbcType=VARCHAR},dqusername = #{dqusername,jdbcType=VARCHAR},headman = #{headman,jdbcType=INTEGER},"
			+ "auditstate = #{auditstate,jdbcType=VARCHAR},auditopn = #{auditopn,jdbcType=VARCHAR},auditdate = #{auditdate,jdbcType=DATE},allstate = #{allstate,jdbcType=VARCHAR},alltime = #{alltime},latesttime = #{latesttime},ctid = #{ctid,jdbcType=VARCHAR},ljid = #{ljid,jdbcType=VARCHAR},dqid = #{dqid,jdbcType=VARCHAR} where inspnum = #{inspnum,jdbcType=VARCHAR}")
	void updateConstCjcjy(ScsConstinsp scsConstinsp);

	//更新建造检验-船检处审核
	@Update("update scs_constinsp set ctname = #{ctname,jdbcType=VARCHAR},ctusername = #{ctusername,jdbcType=VARCHAR},ljname = #{ljname,jdbcType=VARCHAR},ljusername = #{ljusername,jdbcType=VARCHAR},dqname = #{dqname,jdbcType=VARCHAR},dqusername = #{dqusername,jdbcType=VARCHAR},headman = #{headman,jdbcType=INTEGER},"
			+ "auditstate = #{auditstate,jdbcType=VARCHAR},auditopn = #{auditopn,jdbcType=VARCHAR},auditdate = #{auditdate,jdbcType=DATE},allstate = #{allstate,jdbcType=VARCHAR},alltime = #{alltime},latesttime = #{latesttime},ctid = #{ctid,jdbcType=VARCHAR},ljid = #{ljid,jdbcType=VARCHAR},dqid = #{dqid,jdbcType=VARCHAR} where inspnum = #{inspnum,jdbcType=VARCHAR}")
	void updateConstCjc(ScsConstinsp scsConstinsp);

	//建造检验完成
	@Update("update scs_constinsp set state = '完成', flag = '完成' where inspnum = #{inspnum,jdbcType=VARCHAR}")
	void completeConst(String inspnum);

	//建造检验未完成
	@Update("update scs_constinsp set state = '未完成', flag = '未完成' where inspnum = #{inspnum,jdbcType=VARCHAR}")
	void uncompleteConst(String inspnum);

	//禁用建造检验
	@Update("update scs_constinsp set state = '禁用' where inspnum = #{inspnum,jdbcType=VARCHAR}")
	void forbidConst(String inspnum);

	//恢复建造检验
	@Update("update scs_constinsp set state = flag where inspnum = #{inspnum,jdbcType=VARCHAR}")
	void renewConst(String inspnum);

	//删除建造检验
	@Delete("delete from scs_constinsp where inspnum = #{inspnum,jdbcType=VARCHAR}")
	void deleteConst(String inspnum);

	//建造检验报检单完成数+1
	@Update("update scs_constinsp set completenum = completenum+1 where inspnum = #{inspnum,jdbcType=VARCHAR}")
	void constCompleteUp(String inspnum);

	//建造检验报检单完成数-1
	@Update("update scs_constinsp set completenum = completenum-1 where inspnum = #{inspnum,jdbcType=VARCHAR}")
	void constCompleteDown(String inspnum);


	/*
	 * 报检单操作
	 */
	//查询报检单条数(所有)
	@Select("select count(*) from const_view where inspnum = #{inspnum,jdbcType=VARCHAR}")
	int findInspdclrCount(String inspnum);

	//查询报检单列表(所有)
	@Select("select inspname, inspdate, idstate, idlatesttime, cc, flag from const_view where inspnum = #{inspnum,jdbcType=VARCHAR} order by idlatesttime desc")
	List<ScsInspdclr> findAllInspdclr(String inspnum);

	//查询报检单条数(报检单名称)
	@Select("select count(*) from const_view where inspnum = #{inspnum,jdbcType=VARCHAR} and inspname like CONCAT(CONCAT('%', #{inspname}), '%')")
	int findInspdclrByCount(@Param("inspnum") String inspnum, @Param("inspname") String inspname);

	//查询报检单列表(报检单名称)
	@Select("select inspname, inspdate, idstate, idlatesttime, cc, flag from const_view where inspnum = #{inspnum,jdbcType=VARCHAR} and inspname like CONCAT(CONCAT('%', #{inspname}), '%') order by idlatesttime desc")
	List<ScsInspdclr> findByInspdclr(@Param("inspnum") String inspnum, @Param("inspname") String inspname);

	//历史查询报检单条数(所有)
	@Select("select count(*) from const_view where inspnum = #{inspnum,jdbcType=VARCHAR} and (idstate = '完成' or idstate = '整改完成')")
	int findHiInspdclrCount(String inspnum);

	//历史查询报检单列表(所有)
	@Select("select inspname, inspdate, idstate, idlatesttime, cc, flag from const_view where inspnum = #{inspnum,jdbcType=VARCHAR} and (idstate = '完成' or idstate = '整改完成') order by idlatesttime desc")
	List<ScsInspdclr> findHiAllInspdclr(String inspnum);

	//历史查询报检单条数(报检单名称)
	@Select("select count(*) from const_view where inspnum = #{inspnum,jdbcType=VARCHAR} and (idstate = '完成' or idstate = '整改完成') and inspname like CONCAT(CONCAT('%', #{inspname}), '%')")
	int findHiInspdclrByCount(@Param("inspnum") String inspnum, @Param("inspname") String inspname);

	//历史查询报检单列表(报检单名称)
	@Select("select inspname, inspdate, idstate, idlatesttime, cc, flag from const_view where inspnum = #{inspnum,jdbcType=VARCHAR} and (idstate = '完成' or idstate = '整改完成') and inspname like CONCAT(CONCAT('%', #{inspname}), '%') order by idlatesttime desc")
	List<ScsInspdclr> findHiByInspdclr(@Param("inspnum") String inspnum, @Param("inspname") String inspname);

	//查询报检单信息
	@Select("select shipname, figurenum, ccpronum, apnttime, inspname, insppro, cc, rq1, cdopinion, cd, rq2, status, confirmtime, ycs1, rq3, inspopinion, opncontent, rectopinion, ccopn, ccopndate, cdopn, cdopndate, rectresult, rectnum, ycs2, rq4, confirmresult, ycs3, rq5, idstate from const_view where inspnum = #{inspnum,jdbcType=VARCHAR} and inspdate = #{inspdate}")
	ScsInspdclr findIdByInspnum(@Param("inspnum") String inspnum, @Param("inspdate") String inspdate);

	//打印报检单信息
	@Select("select shipname, figurenum, ccpronum, apnttime, inspname, insppro, cc, rq1, cdopinion, cd, rq2, inspopinion, opncontent,rectnum, ycs2, rq4 from const_view where inspnum = #{inspnum,jdbcType=VARCHAR} and inspdate = #{inspdate}")
	ScsInspdclr printIdByInspnum(@Param("inspnum") String inspnum, @Param("inspdate") String inspdate);

	//打印船舶质量检验控制表信息
	@Select("select inspnum, inspdate, shipname, figurenum, ccpronum, apnttime, inspname, insppro, cc, rq1, idstate, idlatesttime, cdopinion, cd, rq2, status, confirmtime, ycs1, rq3, inspopinion, rectopinion, ccopn, ccopndate, cdopn, cdopndate, rectresult, rectnum, ycs2, rq4 from const_view where inspnum = #{inspnum,jdbcType=VARCHAR} and inspdate = #{inspdate}")
	ScsInspdclr printSqccByInspnum(@Param("inspnum") String inspnum, @Param("inspdate") String inspdate);

	//新建报检单-船厂提交
	@Insert("insert into scs_inspdclr (inspnum, inspdate, inspname, apnttime, insppro, cc, rq1, idstate, idlatesttime) values (#{inspnum,jdbcType=VARCHAR}, #{inspdate,jdbcType=VARCHAR}, #{inspname,jdbcType=VARCHAR}, #{apnttime,jdbcType=DATE}, "
			+ "#{insppro,jdbcType=VARCHAR}, #{cc,jdbcType=VARCHAR}, #{rq1,jdbcType=DATE}, #{idstate,jdbcType=VARCHAR}, #{idlatesttime})")
	void saveIdCc(ScsInspdclr scsInspdclr);

	//更新报检单-船厂提交
	@Update("update scs_inspdclr set inspname = #{inspname,jdbcType=VARCHAR},apnttime = #{apnttime,jdbcType=DATE},insppro = #{insppro,jdbcType=VARCHAR},cc = #{cc,jdbcType=VARCHAR},"
			+ "rq1 = #{rq1,jdbcType=DATE},idlatesttime = #{idlatesttime} where inspnum = #{inspnum,jdbcType=VARCHAR} and inspdate = #{inspdate}")
	void updateIdCc(ScsInspdclr scsInspdclr);

	//更新报检单-船东审核
	@Update("update scs_inspdclr set idlatesttime = #{idlatesttime},idstate = #{idstate,jdbcType=VARCHAR},cdopinion = #{cdopinion,jdbcType=VARCHAR},cd = #{cd,jdbcType=VARCHAR},rq2 = #{rq2,jdbcType=DATE} where inspnum = #{inspnum,jdbcType=VARCHAR} and inspdate = #{inspdate}")
	void updateIdCd(ScsInspdclr scsInspdclr);

	//更新报检单-验船师确认
	@Update("update scs_inspdclr set idlatesttime = #{idlatesttime},idstate = #{idstate,jdbcType=VARCHAR},status = #{status,jdbcType=VARCHAR},confirmtime = #{confirmtime,jdbcType=DATE},"
			+ "ycs1 = #{ycs1,jdbcType=VARCHAR},rq3 = #{rq3,jdbcType=DATE} where inspnum = #{inspnum,jdbcType=VARCHAR} and inspdate = #{inspdate}")
	void updateIdYcsConfirm(ScsInspdclr scsInspdclr);

	//更新报检单-验船师检验
	@Update("update scs_inspdclr set idlatesttime = #{idlatesttime},idstate = #{idstate,jdbcType=VARCHAR},inspopinion = #{inspopinion,jdbcType=VARCHAR},opncontent = #{opncontent,jdbcType=VARCHAR},rectopinion = #{rectopinion,jdbcType=VARCHAR},rectresult = #{rectresult,jdbcType=VARCHAR},"
			+ "rectnum = #{rectnum,jdbcType=VARCHAR},ycs2 = #{ycs2,jdbcType=VARCHAR},rq4 = #{rq4,jdbcType=DATE},confirmresult = #{confirmresult,jdbcType=VARCHAR},ycs3 = #{ycs3,jdbcType=VARCHAR},rq5 = #{rq5,jdbcType=DATE} where inspnum = #{inspnum,jdbcType=VARCHAR} and inspdate = #{inspdate}")
	void updateIdYcscheck(ScsInspdclr scsInspdclr);

	//更新报检单-验船师检验-船厂意见
	@Update("update scs_inspdclr set ccopn = #{ccopn,jdbcType=VARCHAR},ccopndate = #{ccopndate,jdbcType=VARCHAR} where inspnum = #{inspnum,jdbcType=VARCHAR} and inspdate = #{inspdate}")
	void updateIdCcopn(ScsInspdclr scsInspdclr);

	//更新报检单-验船师检验-船东意见
	@Update("update scs_inspdclr set cdopn = #{cdopn,jdbcType=VARCHAR},cdopndate = #{cdopndate,jdbcType=VARCHAR} where inspnum = #{inspnum,jdbcType=VARCHAR} and inspdate = #{inspdate}")
	void updateIdCdopn(ScsInspdclr scsInspdclr);

	//删除报检单(单个)
	@Delete("delete from scs_inspdclr where inspnum = #{inspnum,jdbcType=VARCHAR} and inspdate = #{inspdate}")
	void deleteId(@Param("inspnum") String inspnum, @Param("inspdate") String inspdate);

	//删除报检单(多个)
	@Delete("delete from scs_inspdclr where inspnum = #{inspnum,jdbcType=VARCHAR}")
	void deleteIdAll(@Param("inspnum") String inspnum);
}